<template>
  <el-dialog v-dialog-drag append-to-body :close-on-click-modal="false" width="1200px" :visible.sync="visible"
    :before-close="beforeClose" title="质量问题列表">
    <div class="wrapper">
      <el-table v-loading="loading" :data="list">
        <el-table-column label="问题编号" width="200" prop="workNo" />
        <el-table-column label="问题整改状态" width="120" prop="dataStatus">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.list_quality_data_status" :value="scope.row.dataStatus" />
          </template>
        </el-table-column>
        <el-table-column label="质量问题名称" prop="controlMeasures" />
        <el-table-column label="整改人" width="140" prop="revisePeopleName" />
        <el-table-column label="复查人" width="140" prop="reviewUserName" />
        <el-table-column label="通知人" width="120" prop="notifierName" />
        <el-table-column label="要求整改完成日期" width="140" prop="reviseTheDates" />
      </el-table>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button size="mini" @click="beforeClose">取消</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { getQualityProblemList } from "../api";
export default {
  name: "QualityListDialog",
  props: {
    visible: Boolean,
    data: {
      type: Object,
      default: () => { }
    },
  },
  dicts: ["list_quality_data_status"],
  data() {
    return {
      projectId: this.$store.state.app.selectData,
      list: [],
      loading: false,
    };
  },
  created() {
    this.initData();
  },
  methods: {
    async initData() {
      const res = await getQualityProblemList({ fileId: this.data.id||this.data.enterCheckProjectId })
      this.list = res.data;
    },
    beforeClose() {
      this.$emit('update:visible', false);
    },
  },
};
</script>
<style lang="scss" scoped>
.wrapper {
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;

  .el-select {
    width: 100%;
  }

  .el-date-editor {
    width: 100%;
  }
}
</style>
